#ifndef MODBUS_H
#define MODBUS_H
#define MAX_4XXXX   100

#define APP_REG_BASE            10
#define TEMPERATURE_REG         APP_REG_BASE        // 10
#define PRESURE_REG_HI          TEMPERATURE_REG+1   // 11
#define PRESURE_REG_LO          PRESURE_REG_HI+1    // 12
#define ALTITUDE_REG            PRESURE_REG_LO+1    // 13
#define MPU3050_TEMP            ALTITUDE_REG+1      // 14
#define ECOMPASS_X_RAW          MPU3050_TEMP+1      // 15
#define ECOMPASS_Y_RAW          ECOMPASS_X_RAW+1    // 16
#define ECOMPASS_Z_RAW          ECOMPASS_Y_RAW+1    // 17
#define VOLTAGE_VAL_REG         ECOMPASS_Z_RAW+1    // 18
#define CURRENT_VAL_REG         VOLTAGE_VAL_REG+1   // 19
#define VOLTAGE_COUNT_REG       CURRENT_VAL_REG+1    // 20
#define CURRENT_COUNT_REG       VOLTAGE_COUNT_REG+1  // 21
#define MA_HOUR_REG            CURRENT_COUNT_REG+1   // 22
#define CAL_FLAG_REG            MA_HOUR_REG+1          //23
#define REF_VOLT_REG            CAL_FLAG_REG+1      // 24
#define REF_CURRENT_REG         REF_VOLT_REG+1    // 25




#define ECOMPASS_DEG_REG        0
#define PWM_IN_REG              1        /* 0 ~ 100 % */
#define PWM_OUT_REG             2        /* 0~100 % */

#define P_REG                   3
#define I_REG                   4
#define STATE_REG               5
#define HEADING_BASE_REG        6
#define HEADING_TARGET_REG      7
#define HEADING_CURRENT_REG     8
#define STEER_ANGLE_REG         9

extern void ModbusTask( void *pvParameters );
extern INT16U  Reg4xxxx[MAX_4XXXX];
#endif
